home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / software / vyzkuste / spyware / spyware.exe / Microsoft Baseline Security Analyzer / MBSASetup-EN.msi / Data.Cab / dropdown.js < prev    next >
Text File  |  2004-08-13  |  20KB  |  789 lines

  1. //
  2. // ⌐ 2002-2004, Microsoft Corporation. All rights reserved.
  3. // Developed By Shavlik Technologies, LLC
  4. //
  5.  
  6. var comboBoxArray = new Array();
  7. var IPcomboBoxArray = new Array();
  8. var SUScomboBoxArray = new Array();
  9.  
  10. function CreateComboBoxObject(strDropDownListID, strComboBoxName)
  11. {
  12.     this.Mycmb = document.all[strDropDownListID];
  13.     this.SetDefaultText                = SetDefaultText;
  14.     this.Mycmb.selectedIndex        = -1;
  15.     this.UseStateFunctions            = false;
  16.     this.Clear                        = Clear;
  17.     this.GetSelectedText            = GetSelectedText;
  18.     this.AlignTextBoxOverDropDown    = AlignTextBoxOverDropDown;
  19.     this.cbo_OnChange                = cbo_OnChange;
  20.     this.txt_OnBlur                    = txt_OnBlur; 
  21.     this.txt_OnChange                    = txt_OnChange; 
  22.     this.setDefaultIndex            = setDefaultIndex;
  23.     this.txt_OnKeyUp                = txt_OnKeyUp;
  24.     this.focus                        = focus;
  25.     //do lookup or not
  26.     this.LookupValues                = true;
  27.     this.SetAccessKey                = SetAccessKey;
  28.     //case sensitivity
  29.     this.LookupCaseInSensitive    = true;
  30.     //store the previous text for the lookup
  31.     this.MytxtPreviousValue            = "";
  32.     //generate the text box on the fly
  33.     
  34.     var strMytxtID = "txtMytxt" + strDropDownListID;
  35.  
  36.     var strDummytxt = '<input type="text" ID="Text1" NAME="Text1" style="visibility: hidden; width:1"></input>';
  37.     var strMytxt = strDummytxt + "<INPUT type='text' id=" + strMytxtID + " name=" + strMytxtID + " onblur='" + strComboBoxName + ".txt_OnBlur()' " + 
  38.                        " onkeyup='" + strComboBoxName + ".txt_OnKeyUp()' " +
  39.                        " onchange='" + strComboBoxName + ".txt_OnChange()' " +
  40.                        " style='display: none;' value='' >";
  41.  
  42.     this.Mycmb.insertAdjacentHTML("afterEnd", strMytxt);
  43.     //assign obj to new textbox
  44.     this.Mytxt = document.all[strMytxtID];
  45.  
  46.     var strMyHiddentxtID = strDropDownListID + "_value";
  47.     
  48.     var strMyHiddentxt = "<INPUT type='hidden' " + " id=" + strMyHiddentxtID + " name=" + strMyHiddentxtID + " >";
  49.  
  50.     this.Mycmb.insertAdjacentHTML("afterEnd", strMyHiddentxt);
  51.     this.MyHiddentxt = document.all[strMyHiddentxtID];
  52.  
  53.     this.AdjustingSize = false;
  54.     this.AlignTextBoxOverDropDown();
  55.  
  56.     comboBoxArray[comboBoxArray.length] = this;
  57. }
  58.  
  59. function SetAccessKey(Key)
  60. {
  61.     this.Mytxt.accessKey = Key;
  62. }
  63.  
  64. function CreateIPComboBoxObject(strDropDownListID, strComboBoxName)
  65. {
  66.     this.MyIPcmb = document.all[strDropDownListID];
  67.     this.MyIPcmb.selectedIndex        = -1;
  68.     this.UseStateFunctions        = false;
  69.     this.AlignIPCombo    = AlignIPCombo;
  70.     this.cboIP_OnChange                = cboIP_OnChange;
  71.     this.cboIPRange_OnChange                = cboIPRange_OnChange;
  72.     this.UseStateFunctions = false;
  73.     this.AdjustingSize = false;
  74.     this.IPAddressArrowUp = IPAddressArrowUp;
  75.     this.IPAddressArrowDown = IPAddressArrowDown;
  76.     this.IPRangeAddressArrowUp = IPRangeAddressArrowUp;
  77.     this.IPRangeAddressArrowDown = IPRangeAddressArrowDown;
  78.     this.AlignIPCombo();
  79.  
  80.     IPcomboBoxArray[IPcomboBoxArray.length] = this;
  81. }
  82.  
  83. function CreateSUSComboBoxObject(strDropDownListID, strComboBoxName)
  84. {
  85.     this.MySUScmb = document.all[strDropDownListID];
  86.     this.MySUScmb.selectedIndex        = -1;
  87.     this.AlignSUSTextBoxOverDropDown    = AlignSUSTextBoxOverDropDown;
  88.     this.GetSUSSelectedText            = GetSUSSelectedText;
  89.     this.cboSUS_OnChange                = cboSUS_OnChange;
  90.     this.DisableSUS = DisableSUS;
  91.     this.EnableSUS = EnableSUS;
  92.     this.AdjustingSize = false;
  93.     this.SetDefaultSUSText            = SetDefaultSUSText;
  94.     var strMytxtID = "txtMytxt" + strDropDownListID;
  95.     var strMytxt = "<INPUT type='text' id=" + strMytxtID + " name=" + strMytxtID + " style='display: none; position: absolute' value='' >";
  96.     this.MySUScmb.insertAdjacentHTML("afterEnd", strMytxt);
  97.     //assign obj to new textbox
  98.     this.MySUStxt = document.all[strMytxtID];
  99.  
  100.     this.AlignSUSTextBoxOverDropDown();
  101.     SUScomboBoxArray[SUScomboBoxArray.length] = this;
  102. }
  103.  
  104. function SetDefaultSUSText(Text)
  105. {
  106.     this.MySUScmb.selectedIndex = -1;
  107.     this.MySUStxt.value = Text;
  108. }
  109.  
  110. function DisableSUS()
  111. {
  112.     this.MySUScmb.disabled = true;
  113.     this.MySUStxt.disabled = true;
  114. }
  115.  
  116. function EnableSUS()
  117. {
  118.     this.MySUScmb.disabled = false;
  119.     this.MySUStxt.disabled = false;
  120. }
  121.  
  122. function AlignIPCombos()
  123. {
  124.     var iIndex;
  125.     for (iIndex=0; iIndex < comboBoxArray.length; iIndex++)
  126.     {
  127.         IPcomboBoxArray[iIndex].AlignIPCombo();
  128.     }
  129. }
  130.  
  131. function AlignIPCombo()
  132. {    
  133.     if (!this.AdjustingSize)
  134.     {
  135.         var lastIPLeft = 0;
  136.         var lastIPWidth = 0;
  137.         
  138.         this.AdjustingSize = true;
  139.         this.MyIPcmb.style.width     = 0;            // let the combo not interfere on the window size
  140.         this.MyIPcmb.style.position    ="static";
  141.         this.MyIPcmb.style.posLeft    = GetAbsoluteXPosition(document.getElementById("IP1"));
  142.         this.MyIPcmb.style.posTop    = GetAbsoluteYPosition(document.getElementById("IP1"));
  143.  
  144.         this.MyIPcmb.style.position    ="absolute";
  145.  
  146.         if(document.all["IP5"] != null && document.all["IP5"] != 'undefined')
  147.         {//must be an IP Range
  148.             lastIPLeft = GetAbsoluteXPosition(document.getElementById("IP8"));
  149.             lastIPWidth = document.getElementById("IP8").clientWidth;
  150.         }
  151.         else
  152.         {//single IP
  153.             lastIPLeft = GetAbsoluteXPosition(document.getElementById("IP4"));
  154.             lastIPWidth = document.getElementById("IP4").clientWidth;
  155.         }
  156.  
  157.         this.MyIPcmb.style.width = (lastIPLeft + lastIPWidth) - this.MyIPcmb.style.posLeft + 20;
  158.  
  159.         var strClipRectangle = "rect(0 " + 
  160.                         (this.MyIPcmb.offsetWidth) + " " +
  161.                         this.MyIPcmb.offsetHeight + " " +
  162.                     (this.MyIPcmb.offsetWidth - 18) + ")";
  163.  
  164.         this.MyIPcmb.style.clip = strClipRectangle;
  165.         this.AdjustingSize = false;
  166.     }
  167. }
  168.  
  169. function AlignTextBoxesOverDropDowns()
  170. {
  171.     var iIndex;
  172.     for (iIndex=0; iIndex < comboBoxArray.length; iIndex++)
  173.     {
  174.         comboBoxArray[iIndex].AlignTextBoxOverDropDown();
  175.     }
  176. }
  177.  
  178. //sets the default option
  179. function SetDefaultText(Text)
  180. {
  181.  
  182.     this.Mycmb.selectedIndex = -1;
  183.     this.Mytxt.value = Text;
  184. }
  185.  
  186.  
  187. //Move the textbox over the Combo
  188. function AlignTextBoxOverDropDown()
  189. {    
  190.     if (!this.AdjustingSize)
  191.     {
  192.         this.AdjustingSize = true;
  193.         this.Mytxt.style.display="none";
  194.         this.Mycmb.style.position="static";
  195.  
  196.         this.Mytxt.style.posLeft    = GetAbsoluteXPosition(this.Mycmb);
  197.         this.Mytxt.style.posTop        = GetAbsoluteYPosition(this.Mycmb);
  198.         this.Mytxt.style.posWidth    = this.Mycmb.offsetWidth - 16;  // 16 THIS IS THE WIDTH OF THE DROP DOWN ARROW
  199.         this.Mytxt.style.posHeight    = this.Mycmb.offsetHeight;
  200.  
  201.         this.Mycmb.style.position    ="absolute";
  202.         this.Mycmb.style.posLeft    = this.Mytxt.style.posLeft;
  203.         this.Mycmb.style.posTop    = this.Mytxt.style.posTop;
  204.         
  205.         this.ComboWidth = this.Mycmb.offsetWidth;
  206.         var strClipRectangle = "rect(0 " + 
  207.                             (this.Mycmb.offsetWidth) + " " +
  208.                             this.Mycmb.offsetHeight + " " +
  209.                             (this.Mytxt.style.posWidth - 2 ) + ")";
  210.  
  211.         this.Mycmb.style.clip = strClipRectangle;
  212.         this.Mytxt.style.display="";
  213.         this.AdjustingSize = false;
  214.     }
  215.  
  216. }
  217.  
  218. function AlignSUSCombos()
  219. {
  220.     var iIndex;
  221.     for (iIndex=0; iIndex < SUScomboBoxArray.length; iIndex++)
  222.     {
  223.         SUScomboBoxArray[iIndex].AlignSUSTextBoxOverDropDown();
  224.     }
  225. }
  226.  
  227. function AlignSUSTextBoxOverDropDown()
  228. {    
  229.     if (!this.AdjustingSize)
  230.     {
  231.         this.AdjustingSize = true;
  232.         this.MySUStxt.style.display="none";
  233.         this.MySUScmb.style.position="absolute";
  234.  
  235.         this.MySUStxt.style.posLeft    = GetAbsoluteXPosition(document.getElementById("susMRUListContainer"));
  236.         this.MySUStxt.style.posTop        = GetAbsoluteYPosition(document.getElementById("susMRUListContainer")) + 3;
  237.         this.MySUStxt.style.posWidth    = this.MySUScmb.offsetWidth - 16;  // 16 THIS IS THE WIDTH OF THE DROP DOWN ARROW
  238.         this.MySUStxt.style.posHeight    = this.MySUScmb.offsetHeight;
  239.  
  240.         this.MySUScmb.style.position    ="absolute";
  241.         this.MySUScmb.style.posLeft    = this.MySUStxt.style.posLeft;
  242.         this.MySUScmb.style.posTop    = this.MySUStxt.style.posTop;
  243.         
  244.         this.ComboWidth = this.MySUScmb.offsetWidth;
  245.         var strClipRectangle = "rect(0 " + 
  246.                             (this.MySUScmb.offsetWidth) + " " +
  247.                             this.MySUScmb.offsetHeight + " " +
  248.                             (this.MySUStxt.style.posWidth - 2 ) + ")";
  249.  
  250.         this.MySUScmb.style.clip = strClipRectangle;
  251.         this.MySUStxt.style.display="";
  252.         this.AdjustingSize = false;
  253.     }
  254.  
  255. }
  256. function Clear()
  257. {
  258.     this.Mytxt.value = "";
  259.     this.Mycmb.selectedIndex = -1;
  260. }
  261.  
  262. function GetAbsoluteXPosition(element)
  263. {
  264.     var pos = 0;
  265.     while (element != null)
  266.     {
  267.         pos += element.offsetLeft;
  268.         element = element.offsetParent;
  269.     }
  270.  
  271.     return pos;
  272. }
  273.  
  274. function GetAbsoluteYPosition(element)
  275. {
  276.     var pos = 0;
  277.     while (element != null )
  278.     {
  279.         pos += element.offsetTop;
  280.         element = element.offsetParent;
  281.     }
  282.  
  283.     return pos;
  284. }
  285. function GetSUSSelectedText()
  286. {
  287.     return this.MySUStxt.value;
  288. }
  289.  
  290. function GetSelectedText()
  291. {
  292.     return this.Mytxt.value;
  293. }
  294.  
  295. function cboIP_OnChange()
  296. {
  297.     var tmpIndex = this.MyIPcmb.selectedIndex;
  298.     var tempOption = this.MyIPcmb.options[tmpIndex];
  299.     
  300.     var IPArr = tempOption.text.split(".")
  301.     if( IPArr.length == 4 )
  302.     {
  303.         document.all["IP1"].value = IPArr["0"];
  304.         document.all["IP2"].value = IPArr["1"];
  305.         document.all["IP3"].value = IPArr["2"];
  306.         document.all["IP4"].value = IPArr["3"];
  307.     }
  308.     else
  309.     {
  310.         document.all["IP1"].value = "";
  311.         document.all["IP2"].value = "";
  312.         document.all["IP3"].value = "";
  313.         document.all["IP4"].value = "";
  314.     }
  315.  
  316.     this.MyIPcmb.selectedIndex=-1;
  317.     if(this.UseStateFunctions) 
  318.     {
  319.         SetState("IP");
  320.     }
  321. }
  322.  
  323. function cboIPRange_OnChange()
  324. {
  325.     var tmpIndex = this.MyIPcmb.selectedIndex;
  326.     var tempOption = this.MyIPcmb.options[tmpIndex];
  327.  
  328.     var IPRange = tempOption.text; 
  329.     var IPArr = IPRange.split("to")
  330.     var IP1 = IPArr["0"].split(".");
  331.     var IP2 = IPArr["1"].split(".");
  332.     
  333.     if( IP1.length == 4 && IP2.length == 4 )
  334.     {
  335.         document.all["IP1"].value = IP1["0"];
  336.         document.all["IP2"].value = IP1["1"];
  337.         document.all["IP3"].value = IP1["2"];
  338.         document.all["IP4"].value = IP1["3"].substring(0,IP1["3"].length-1);
  339.         document.all["IP5"].value = IP2["0"].substring(1,IP2["0"].length);
  340.         document.all["IP6"].value = IP2["1"];
  341.         document.all["IP7"].value = IP2["2"];
  342.         document.all["IP8"].value = IP2["3"];
  343.     }
  344.     else
  345.     {
  346.         document.all["IP1"].value = "";
  347.         document.all["IP2"].value = "";
  348.         document.all["IP3"].value = "";
  349.         document.all["IP4"].value = "";
  350.         document.all["IP5"].value = "";
  351.         document.all["IP6"].value = "";
  352.         document.all["IP7"].value = "";
  353.         document.all["IP8"].value = "";
  354.     }
  355.     
  356.     if(this.UseStateFunctions) 
  357.     {
  358.         SetState("IP");
  359.     }
  360.     this.MyIPcmb.selectedIndex=-1;
  361. }
  362.  
  363. function cbo_OnChange()
  364. {
  365.     var tmpIndex = this.Mycmb.selectedIndex;
  366.     var tempOption = this.Mycmb.options[tmpIndex];
  367.     this.Mytxt.value  = tempOption.text;
  368.     
  369.     this.Mytxt.focus();
  370.     this.Mytxt.select();
  371.     
  372.     if(this.UseStateFunctions) 
  373.     {
  374.         SetState("CPU");
  375.     }
  376.     this.Mycmb.selectedIndex=-1;
  377.     test_ThisComputer(this.Mytxt);
  378. }
  379.  
  380. function cboSUS_OnChange()
  381. {
  382.     
  383.     var tmpIndex = this.MySUScmb.selectedIndex;
  384.     var tempOption = this.MySUScmb.options[tmpIndex];
  385.     
  386.     this.MySUStxt.value  = tempOption.text;
  387.     
  388.     this.MySUStxt.focus();
  389.     this.MySUStxt.select();
  390.     
  391.     this.MySUScmb.selectedIndex=-1;
  392. }
  393.  
  394. // This method trims white space off both ends of this string and returns the result.
  395. function Trim(str)
  396. {
  397.     return(str.replace(/^\s*/,'').replace(/\s*$/,''));
  398. }
  399.  
  400. function test_ThisComputer(control)
  401. {
  402.     if( ! document.all["thisComputerLabel"] )
  403.         return;
  404.  
  405.     // assemble the domain\computername for this station
  406.     thisComputerID = parent.Scanner.LocalDomain + "\\" + parent.Scanner.LocalMachine;
  407.     isThisComputer = ( Trim(control.value.toUpperCase()) == Trim(thisComputerID.toUpperCase()) );
  408.  
  409.     if( isThisComputer )
  410.     {
  411.         document.all["thisComputerLabel"].value = Trim(parent.Scanner.ThisComputer);
  412.     }
  413.     else
  414.     {
  415.         document.all["thisComputerLabel"].value = "";
  416.     }
  417. }
  418.  
  419. function txt_OnKeyUp()
  420. {        
  421.     test_ThisComputer(this.Mytxt);
  422.     if (this.LookupValues)
  423.     {
  424.         if (event.keyCode < 32)  
  425.         {
  426.             return;
  427.         }
  428.         else if (event.keyCode == 46)  
  429.         {
  430.             return;
  431.         }
  432.         else if (event.keyCode == 38)//up arrow  
  433.         {
  434.             var len = this.Mycmb.options.length;
  435.             if(len > 0)
  436.             {
  437.                 var tempString;
  438.                 var curText        = this.Mytxt.value;
  439.                 var FoundIndex = -1;
  440.                 for (var iIndex=0; iIndex<len; iIndex++)
  441.                 {
  442.                     tempString = this.Mycmb.options(iIndex).text;
  443.                     
  444.                     tempString = tempString.toUpperCase();
  445.                     curText = curText.toUpperCase();
  446.                     if (tempString == curText)
  447.                     {
  448.                         FoundIndex = iIndex;
  449.                     }
  450.                 }
  451.                 if(FoundIndex == -1)
  452.                 {
  453.                     //do nothing
  454.                 }
  455.                 else
  456.                 {
  457.                     if(FoundIndex > 0)
  458.                     {
  459.                         this.Mytxt.value = this.Mycmb.options(FoundIndex -1).text;
  460.                         var tmpRange = this.Mytxt.createTextRange();
  461.                         tmpRange.moveStart("character", this.Mytxt.length);
  462.                         tmpRange.select();
  463.                         SetState("CPU");
  464.                     }
  465.                 }
  466.             }            
  467.             test_ThisComputer(this.Mytxt);
  468.             return;
  469.         }
  470.         else if (event.keyCode == 40)//Down arrow  
  471.         {
  472.             var len = this.Mycmb.options.length;
  473.             if(len > 0)
  474.             {
  475.                 var tempString;
  476.                 var curText        = this.Mytxt.value;
  477.                 var FoundIndex = -1;
  478.             
  479.                 for (var iIndex=0; iIndex<len; iIndex++)
  480.                 {
  481.                     
  482.                     tempString = this.Mycmb.options(iIndex).text;    
  483.                     tempString = tempString.toUpperCase();
  484.                     curText = curText.toUpperCase();
  485.                     if (tempString == curText)
  486.                     {
  487.                         FoundIndex = iIndex;
  488.                     }
  489.                 }
  490.                 if(FoundIndex == -1)
  491.                 {
  492.                     this.Mytxt.value = this.Mycmb.options(0).text;
  493.                     var tmpRange = this.Mytxt.createTextRange();
  494.                     tmpRange.moveStart("character", this.Mytxt.length);
  495.                     tmpRange.select();
  496.                     SetState("CPU");
  497.                 }
  498.                 else
  499.                 {    
  500.                     if(FoundIndex < this.Mycmb.options.length - 1)
  501.                     {
  502.                         this.Mytxt.value = this.Mycmb.options(FoundIndex + 1).text;
  503.                         var tmpRange = this.Mytxt.createTextRange();
  504.                         tmpRange.moveStart("character", this.Mytxt.length);
  505.                         tmpRange.select();
  506.                         SetState("CPU");
  507.                     }
  508.                 }
  509.             }
  510.             test_ThisComputer(this.Mytxt);
  511.             return;
  512.         }
  513.         if(this.UseStateFunctions) 
  514.         {
  515.             SetState("CPU");
  516.         }
  517.         var curText        = this.Mytxt.value;
  518.         var prevText    = this.MytxtPreviousValue;
  519.         var iIndex;
  520.  
  521.         if ((curText == "")    || (curText == prevText))
  522.         {
  523.             this.MytxtPreviousValue = curText;
  524.             return;
  525.         }
  526.  
  527.         var len = this.Mycmb.options.length;
  528.         var tempString;
  529.         
  530.         for (iIndex=0; iIndex<len; iIndex++)
  531.         {
  532.             tempString = this.Mycmb.options(iIndex).text;
  533.  
  534.             if (this.LookupCaseInSensitive)
  535.             {
  536.                 tempString = tempString.toUpperCase();
  537.                 curText = curText.toUpperCase();
  538.             }
  539.  
  540.             if (tempString.indexOf(curText) == 0)
  541.             {
  542.                 var helperString = this.Mycmb.options(iIndex).text;
  543.  
  544.                 this.Mytxt.value = this.Mytxt.value + helperString.substr(curText.length);
  545.                 this.Mycmb.selectedIndex = iIndex;
  546.                 this.MytxtPreviousValue = this.Mytxt.value;
  547.  
  548.                 var tmpRange = this.Mytxt.createTextRange();
  549.                 tmpRange.moveStart("character", curText.length);
  550.                 tmpRange.select();
  551.                 test_ThisComputer(this.Mytxt);
  552.                 return;
  553.             }
  554.         }
  555.     }
  556. }
  557.  
  558. function txt_OnBlur()
  559. {
  560.     var myDropDownList    = this.Mycmb;
  561.     var myEditCell        = this.Mytxt;
  562.     var myHiddenCell    = this.MyHiddentxt;
  563.     var iIndex;
  564.  
  565.     test_ThisComputer(this.Mytxt);
  566.  
  567.     myHiddenCell.value = myEditCell.value;
  568.     myDropDownList.selectedIndex = -1;
  569.  
  570.     if (myEditCell.value == "")
  571.     {
  572.         return;
  573.     }
  574.  
  575.     var len = myDropDownList.options.length;
  576.     for (iIndex=0; iIndex<len; iIndex++)
  577.     {
  578.         var str1 = myDropDownList.options(iIndex).text;
  579.         var str2 = myEditCell.value;
  580.  
  581.         if (this.LookupCaseInSensitive)
  582.         {
  583.             str1 = str1.toUpperCase();
  584.             str2 = str2.toUpperCase();
  585.         }
  586.         
  587.         if (str1 == str2)
  588.         {
  589.             myDropDownList.selectedIndex = iIndex;
  590.             myHiddenCell.value = myDropDownList.options(iIndex).value;
  591.             return;
  592.         }
  593.     }
  594.  
  595.     if (this._bOnlyAllowedEntries)
  596.     {
  597.         myDropDownList.focus();    
  598.  
  599.         alert("\'" + myEditCell.value + "\' is not allowed");
  600.         this.Mycmb.selectedIndex = -1;
  601.         this.Mytxt.select();
  602.         
  603.         return;
  604.     }
  605. }
  606.  
  607. function txt_OnChange()
  608. {
  609.     test_ThisComputer(this.Mytxt);
  610.     if(this.UseStateFunctions) 
  611.     {
  612.         SetState("CPU");
  613.     }
  614. }
  615.  
  616. function focus()
  617. {
  618.     this.Mycmb.focus();
  619. }
  620.  
  621. function setDefaultIndex(iIndex)
  622. {
  623.     var len = this.Mycmb.options.length;
  624.     if ((iIndex >=0) && (iIndex < len))
  625.     {
  626.         this.Mycmb.selectedIndex = iIndex;
  627.         this.Mytxt.value = this.Mycmb.options(iIndex).text;
  628.         this.MyHiddentxt.value = this.Mycmb.options(iIndex).value;
  629.         return;
  630.     }
  631.  
  632.     this.Mytxt.value = "";
  633. }
  634.  
  635. function IPAddressArrowUp(curText)
  636. {
  637.     var len = this.MyIPcmb.options.length;
  638.     if(len > 0)
  639.     {
  640.         var tempString;
  641.         var FoundIndex = -1;
  642.         var NewValue = "";
  643.         for (var iIndex=0; iIndex<len; iIndex++)
  644.         {
  645.             tempString = this.MyIPcmb.options(iIndex).text;
  646.             if (tempString.toString() == curText.toString())
  647.             {
  648.                 FoundIndex = iIndex;
  649.             }
  650.         }
  651.         if(FoundIndex == -1)
  652.         {
  653.             //do nothing
  654.             NewValue = curText;
  655.         }
  656.         else
  657.         {
  658.             if(FoundIndex > 0)
  659.             {
  660.                 NewValue = this.MyIPcmb.options(FoundIndex -1).text;
  661.             }
  662.         }
  663.         return NewValue;
  664.     }
  665.     else
  666.         return "";
  667. }
  668. function IPAddressArrowDown(curText)
  669. {
  670.     var len = this.MyIPcmb.options.length;
  671.     if(len > 0)
  672.     {
  673.         var tempString;
  674.         var NewValue = "";
  675.         var FoundIndex = -1;
  676.         for (var iIndex=0; iIndex<len; iIndex++)
  677.         {
  678.             tempString = this.MyIPcmb.options(iIndex).text;
  679.  
  680.             if (tempString.toString() == curText.toString())
  681.             {
  682.                 FoundIndex = iIndex;
  683.             }
  684.         }
  685.         if(FoundIndex == -1)
  686.         {
  687.             NewValue = this.MyIPcmb.options(0).text;
  688.         }
  689.         else
  690.         {
  691.             if(FoundIndex < this.MyIPcmb.options.length - 1)
  692.             {
  693.                 NewValue = this.MyIPcmb.options(FoundIndex + 1).text;
  694.             }
  695.         }
  696.  
  697.         return NewValue;
  698.     }
  699.     else
  700.         return "";
  701. }
  702.  
  703. function IPRangeAddressArrowUp(curText)
  704. {
  705.     var len = this.MyIPcmb.options.length;
  706.     
  707.     if(len > 0)
  708.     {
  709.         var curIPArr = curText.split("to");
  710.         var curIP1 = curIPArr["0"].substring(0,curIPArr["0"].length -1);
  711.         var curIP2 = curIPArr["1"].substring(1,curIPArr["1"].length -1);
  712.     
  713.         var tempString;
  714.         var FoundIndex = -1;
  715.         var NewValue = "";
  716.         for (var iIndex=0; iIndex<len; iIndex++)
  717.         {
  718.             tempString = this.MyIPcmb.options(iIndex).text;
  719.             
  720.             var IPArr = tempString.split("to");
  721.             var IP1 = IPArr["0"].substring(0,IPArr["0"].length -1);
  722.             var IP2 = IPArr["1"].substring(1,IPArr["1"].length -1);
  723.             if (curIP1.toString() == IP1.toString() && curIP2.toString() == IP2.toString())
  724.             {
  725.                 FoundIndex = iIndex;
  726.             }
  727.         }
  728.         if(FoundIndex == -1)
  729.         {
  730.             //do nothing
  731.             NewValue = curText;
  732.         }
  733.         else
  734.         {
  735.             if(FoundIndex > 0)
  736.             {
  737.                 NewValue = this.MyIPcmb.options(FoundIndex -1).text;
  738.             }
  739.         }
  740.         return NewValue;
  741.     }
  742.     else
  743.         return "";
  744. }
  745.  
  746. function IPRangeAddressArrowDown(curText)
  747. {
  748.     var len = this.MyIPcmb.options.length;
  749.     
  750.     if(len > 0)
  751.     {
  752.         var curIPArr = curText.split("to");
  753.         var curIP1 = curIPArr["0"].substring(0,curIPArr["0"].length -1);
  754.         var curIP2 = curIPArr["1"].substring(1,curIPArr["1"].length -1);
  755.     
  756.         var tempString;
  757.         var FoundIndex = -1;
  758.         var NewValue = "";
  759.         for (var iIndex=0; iIndex<len; iIndex++)
  760.         {
  761.             tempString = this.MyIPcmb.options(iIndex).text;
  762.             
  763.             var IPArr = tempString.split("to");
  764.             var IP1 = IPArr["0"].substring(0,IPArr["0"].length -1);
  765.             var IP2 = IPArr["1"].substring(1,IPArr["1"].length -1);
  766.             if (curIP1.toString() == IP1.toString() && curIP2.toString() == IP2.toString())
  767.             {
  768.                 FoundIndex = iIndex;
  769.             }
  770.         }
  771.         if(FoundIndex == -1)
  772.         {
  773.             //do nothing
  774.             NewValue = curText;
  775.         }
  776.         else
  777.         {
  778.             if(FoundIndex < this.MyIPcmb.options.length - 1)
  779.             {
  780.                 NewValue = this.MyIPcmb.options(FoundIndex + 1).text;
  781.             }
  782.         }
  783.         return NewValue;
  784.     }
  785.     else
  786.         return "";
  787.     
  788. }
  789.